package cn.jtool.dig.server.timer;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@EnableScheduling
public class TimerManager {

    @Resource
    private LogTrafficTask logTrafficTask;
    @Resource
    private TunnelHeartbeatCheckTask tunnelHeartbeatCheckTask;

    @Scheduled(fixedDelay = 1000 * 10)
    public void runLogTrafficTask(){
        this.logTrafficTask.run();
    }

    @Scheduled(fixedDelay = 1000 * 5)
    public void runTunnelHeartbeatCheckTask(){
        this.tunnelHeartbeatCheckTask.run();
    }
}
